package com.huilian.cloud.module.system.dal.mysql.group;

import java.util.*;

import com.huilian.cloud.framework.common.pojo.PageResult;
import com.huilian.cloud.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.huilian.cloud.framework.mybatis.core.mapper.BaseMapperX;
import com.huilian.cloud.module.system.dal.dataobject.group.GroupDO;
import org.apache.ibatis.annotations.Mapper;
import com.huilian.cloud.module.system.controller.admin.group.vo.*;

/**
 * 用户组 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface GroupMapper extends BaseMapperX<GroupDO> {

    default PageResult<GroupDO> selectPage(GroupPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<GroupDO>()
                .likeIfPresent(GroupDO::getGroupName, reqVO.getGroupName())
                .eqIfPresent(GroupDO::getGroupSort, reqVO.getGroupSort())
                .eqIfPresent(GroupDO::getStatus, reqVO.getStatus())
                .eqIfPresent(GroupDO::getDelFlag, reqVO.getDelFlag())
                .eqIfPresent(GroupDO::getCreateBy, reqVO.getCreateBy())
                .betweenIfPresent(GroupDO::getCreateTime, reqVO.getCreateTime())
                .eqIfPresent(GroupDO::getUpdateBy, reqVO.getUpdateBy())
                .eqIfPresent(GroupDO::getRemark, reqVO.getRemark())
                .eqIfPresent(GroupDO::getCreateUserId, reqVO.getCreateUserId())
                .eqIfPresent(GroupDO::getUpdateUserId, reqVO.getUpdateUserId())
                .eqIfPresent(GroupDO::getCreateType, reqVO.getCreateType())
                .eqIfPresent(GroupDO::getOwnerCompanyId, reqVO.getOwnerCompanyId())
                .eqIfPresent(GroupDO::getOwnerUserId, reqVO.getOwnerUserId())
                );
    }

}